<?php

// use Illuminate\Support\Facades\Schema;
use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitCart extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('carts', function (Blueprint $table) {
            $table->comment = '购物车表';
            

            $table->increments('id');
            $table->uuid('uuid')->index();

            $table->integer('user_id')->unsigned()->index()->nullable()->comment('用户id');
            $table->integer('shop_id')->unsigned()->index()->nullable()->comment('店铺id');

            $table->string('product_type', 20)->nullable()->index()->comment('商品类型');
            $table->integer('product_id')->unsigned()->nullable()->index()->comment('商品id');
            $table->integer('sku_id')->unsigned()->index()->comment('sku id');

            $table->integer('money_price')->unsigned()->nullable()->comment('加入购物车时人民币价格');   // 加入购物车时价格
            $table->integer('score_price')->unsigned()->nullable()->comment('加入购物车时积分价格');   // 加入购物车时价格

            $table->integer('total')->unsigned()->default(1)->comment('数量');

            $table->softDeletes();
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('carts');
    }
}
